package com.company.shop;

import com.company.inter.Sets;

import java.util.ArrayList;

/**
 * @description:
 * @author: ZhaoYicong
 * @date: Created in 2020/4/28 16:10
 * @version: v1.0
 * @modified By:
 */
public class ShopSet  implements Sets {
    ArrayList<Shop> shops=new ArrayList<Shop>();


    @Override
    public Shop searchById(String id) {
        Shop shop=null;
        for (Shop item :shops){
            if (item.getId().equals(id)){
                shop=item;
            }
        }
        return shop;
    }

    @Override
    public void add(Object object) {
        if (object instanceof Shop){
            shops.add((Shop) object);
        }else
        {
            System.out.println("类型不匹配！");
        }

    }

    public ArrayList<Shop> getShops() {
        return shops;
    }

    public void setShops(ArrayList<Shop> shops) {
        this.shops = shops;
    }
}
